package linearlist;

import org.junit.Test;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.LinkedList;

/**
 * @author zhm
 * @date 2020/9/25
 */
public class MyDoubleLinkedListTest {

    @Test
    public void testAddAtHead(){
        MyDoubleLinkedList myDoubleLinkedList = new MyDoubleLinkedList();
        myDoubleLinkedList.addAtHead(3);
        myDoubleLinkedList.addAtHead(2);
        myDoubleLinkedList.addAtHead(1);
        System.out.println(myDoubleLinkedList);
    }

    @Test
    public void testAddAtTail(){
        MyDoubleLinkedList myDoubleLinkedList = new MyDoubleLinkedList();
        myDoubleLinkedList.addAtTail(3);
        myDoubleLinkedList.addAtTail(2);
        myDoubleLinkedList.addAtTail(1);
        System.out.println(myDoubleLinkedList);
    }

    @Test
    public void testAddAtIndex(){
        MyDoubleLinkedList myDoubleLinkedList = new MyDoubleLinkedList();
        myDoubleLinkedList.addAtIndex(0,1);
        myDoubleLinkedList.addAtIndex(1,2);
        myDoubleLinkedList.addAtIndex(2,7);
        myDoubleLinkedList.addAtIndex(1,9);
        System.out.println(myDoubleLinkedList);

    }

    @Test
    public void testDeleteAtIndex(){
        MyDoubleLinkedList myDoubleLinkedList = new MyDoubleLinkedList();
        myDoubleLinkedList.addAtIndex(0,0);
        myDoubleLinkedList.addAtIndex(1,1);
        myDoubleLinkedList.addAtIndex(2,2);
        myDoubleLinkedList.addAtIndex(3,3);
        myDoubleLinkedList.addAtIndex(4,4);


        myDoubleLinkedList.deleteAtIndex(6);
        myDoubleLinkedList.deleteAtIndex(1);
        myDoubleLinkedList.deleteAtIndex(2);
        System.out.println(myDoubleLinkedList);
    }

    @Test
    public void testLinkedList(){
        LinkedList linkedList = new LinkedList();
        linkedList.addFirst(1);
        linkedList.addFirst(2);
        linkedList.addFirst(3);
        System.out.println(linkedList);
    }


}
